// 封装 token 的操作
const TOKEN_KEY = 'geek-park';

// setToken 存储token
const setToken = (token) => {
  localStorage.setItem(TOKEN_KEY, token);
};

// removeToken  清除Token
const removeToken = () => {
  localStorage.removeItem(TOKEN_KEY);
};

// getToken  获取Token
const getToken = () => {
  return localStorage.getItem(TOKEN_KEY);
};

// 两个感叹号是返回flaes  一个感叹号是返回true
const hasToken = () => !!getToken();

export { setToken, getToken, removeToken, hasToken };
